<div id="treeContent" style="overflow:scroll; min-height:472px;">
    <div style="padding-bottom:100px">
        {if condition="$firstUserInfo"}
            <table id="contentTable" align="center" cellpadding="0" cellspacing="0" width="100%" style="zoom:100%">
                <tr>
                    <td>
                    <table width="250px" align="left" style="margin:0 auto;">
                        <tbody>
                        <tr>
                            <td align="center" style="color: #fff;width:60px;height:25px;background-color: #3070DE">有效</td>
                            <td align="center" style="color: #fff;width:60px;height:25px;background-color: #aaa">无效</td>
                        </tr>
                        </tbody>
                    </table>
                    <table align="center" style="margin:0 auto;border: 0">
                        <tbody>
                        <tr>
                            <td height="30" align="center">
                                <form action="__URL__/tree" method="get" name="form1" id="form1">
                                    <span style="float:left;height:25px;line-height:25px">会员编号：</span>
                                    <span style="float:left;padding-right:5px">
                                        <input name="search" type="text" id="search" style="width:120px;" value=''/>
                                    </span>
                                    <div style="padding-right:5px;float:left;"><button type="submit">搜索</button></div>
                                    <a class="btn btn-danger"  href="__URL__/tree/search/{$firstUserInfo['tjr_username']}"
                                       style="float:left;margin-left: 40px"><span>上一层</span></a>
                                    <a class="btn btn-info" href='__URL__/tree' style="float:left;margin-left:15px"><span>置顶</span></a>
                                </form>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    </td>
                </tr>
                <tr>
                    <td>
                    {:show_tree($firstUserInfo,$users)}
                    </td>
                </tr>
            </table>
        {else/}
            <table class='list' style="width:500px">
                <thead>
                <tr><th>&nbsp;提示信息</th></tr>
                </thead>
                <tbody>
                    <tr style="height:150px"><td><b>该网络暂无人员！</b></td></tr>
                </tbody>
            </table>
        {/if}
    </div>
</div>



{php}
function show_tree($userInfo,$users) {
{/php}
<!--首先显示firstUser的信息-->
<table width="100" border="1" cellpadding="0" cellspacing="1" align="center" style="margin:0 auto;">
    <tbody>
    <tr>
        <td align="center" bgcolor="#FFFFFF">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" id="overUser_{$userInfo['username']}">
                <tbody>
                <!--username-->
                <tr>
                    <td style="height:20px;line-height:20px;text-align:center;border-bottom:1px solid #A5D1EC;background-color:{eq name='userInfo.status' value='normal'}#3070DE{else/}#333333{/eq}">
                        <a style="width: 100px;color: #ffffff" href="__URL__/tree/search/{$userInfo['username']}">
                            <strong>{$userInfo['username']}</strong>
                        </a>
                    </td>
                </tr>
                <!--昵称或者姓名-->
                <tr>
                    <td style="height:20px;line-height:20px;text-align:center;border-bottom:1px solid #A5D1EC;background-color:{eq name='userInfo.status' value='normal'}#3070DE{else/}#333333{/eq}">
                        <strong style="color: #fff">
                            {empty name="userInfo.nickname"}[暂无]{else/}{$userInfo['nickname']}{/empty}
                        </strong>
                    </td>
                </tr>
                <!--注册时间-->
                <tr>
                    <td style="color:#fff;height:20px;line-height:20px;text-align:center;border-bottom:1px solid #A5D1EC;background-color:{eq name='userInfo.status' value='normal'}#3070DE{else/}#333333{/eq}">
                        {:date('Y-m-d',$userInfo['createtime'])}
                    </td>
                </tr>
                <tr>
                    <td align="center" style="background-color: #E7F2FB;line-height:20px">会员级别</td>
                </tr>
                <tr>
                    <td align="center">层:{:$userInfo['ceng_num']}</td>
                </tr>
                    <!--<tr><td align="" bgcolor="#E7F2FB" style="line-height:20px">总业绩</td></tr>-->
                </tbody>
            </table>
        </td>
    </tr>
    </tbody>
</table>
{php}
    $j=0;
    //计算$users中，有几个是firstUser的一级会员
    foreach($users as $user) {
        if($user['tjr_username'] === $userInfo['username']) {
            $j++;
        }
    }
    if($j == 0) return;
{/php}
<!--上下链接线-->
<table border="0" align="center" cellspacing="0" cellpadding="0" style="margin:0 auto;">
    <tbody><tr>
        <td align="center" style="line-height: 10px; height: 10px;">
            <img style="width:1px;height:20px" alt="" src="/assets/img/line.gif" border="0">
        </td>
    </tr></tbody>
</table>


<table border="0" align="center" cellspacing="0" cellpadding="0" style="margin:0 auto;">

    <tbody>
        <tr>
        <td valign="top">
            <table border="0" cellspacing="0" cellpadding="0">
                <tbody>
                <tr>
                    {php}
                        $i=0;
                        //依次比较推荐人
                        foreach($users as $ks=>$down_user){
                            if($down_user['tjr_username'] !== $userInfo['username']){
                                continue;
                            }
                            $i++;
                            if (!empty($down_user)) {
                    {/php}
                        <td valign="top">
                            <!--处理上下线-->
                            <table border="0" cellspacing="0" cellpadding="0" width="100%" style="margin:0 auto">
                                <tbody>
                                <tr>
                                    <td align="center" valign="top" style="height:10px;line-height:10px">
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tbody><tr>
                                                <!--左右轨迹条显示,这里判断是显示在 左边 还是 右边-->
                                                <td width="50%" height="1" {gt name="i" value="1"}bgcolor="#003399"{/gt} ></td>
                                                <td width="50%" height="1" {neq name="i" value="$j"}bgcolor="#003399"{/neq} ></td>
                                            </tr></tbody>
                                        </table>
                                        <img style="width:1px;height:20px;line-height:20px" src="/assets/img/line.gif" border="0">
                                    </td>
                                </tr></tbody>
                            </table>
                            {//会员信息主体}
                            <table width="100" border="0" bordercolor="#BBBBBB" cellpadding="0"
                                   cellspacing="0" bgcolor="#517DBF" align="center" style="margin:0 auto;">
                                <tbody><tr>
                                    <td align="center" bgcolor="#FFFFFF">
                                        {//输出会员的相关信息 }
                                        {:show_tree($down_user,$users)}
                                    </td>
                                </tr></tbody>
                            </table>
                        </td>
                    {php} } } {/php}
                </tr></tbody>
            </table>
        </td></tr>
    </tbody>
</table>
{php}
    //函数结束
    }
{/php}